package com.zzw.hj63;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @Project: hw_java
 * @Description: DNA序列
 * @Author: zzw
 */

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static double getGCRatio(String s) {
        int count = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'G' || s.charAt(i) == 'C') {
                count++;
            }
        }
        return count * 1.0 / s.length();
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int n = in.nextInt();
        double max = 0.0;
        LinkedHashMap<String, Double> map = new LinkedHashMap<>();
        for (int i = 0; i <= str.length() - n; i++) {
            String sub = str.substring(i, i + n);
            map.put(sub, getGCRatio(sub));
            max = Math.max(max, getGCRatio(sub));
        }
        //System.out.println(max);
        for (Map.Entry<String, Double> entry : map.entrySet()) {
            if (entry.getValue() == max) {
                System.out.println(entry.getKey());
                break;
            }
        }
    }
}